package com.zhen.Service_2;

import com.zhen.Mapper.TeacherMapper;
import com.zhen.User.Fengye;
import com.zhen.User.Student;
import com.zhen.User.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class Teacher2 implements Teacher01{
    @Autowired
    private TeacherMapper teacherMapper;
    @Autowired
    private Fengye fengye;
    public List<Teacher> teselectall(){
        return teacherMapper.selectTeacher();
    }
    public Fengye teselectpage(Integer begin, Integer limit){
        List<Teacher> list=teacherMapper.selectTeacherpage(begin,limit);
        int count=teacherMapper.countTeacher();
        return fengye.fy(count,list);
    }
    public Fengye teselectcha(Integer id,String name,String sex,Integer begin, Integer end){
        List<Teacher> list=teacherMapper.insertTeacher(id, name, sex,begin,end);
        int count=teacherMapper.countcha(id, name, sex);
        return fengye.fy(count,list);
    }
    public Integer deleteTeacher(List<Integer> list){
        Integer del= teacherMapper.delteacher(list);
        return del;
    }
    public Integer updateTeacher(Teacher teacher){
        return teacherMapper.updateTeacher(teacher);
    }
    //添加
    public Integer insertTeacher(Teacher teacher){
        return teacherMapper.jiaTeacher(teacher);
    }
    public Integer updatepwdteacher(Integer id){
        return teacherMapper.updatePassword(id);
    }
    public int teachercount(){
        int count=teacherMapper.countTeacher();
        return count;
    }
}
